package com.qingcheng.dao;

import com.qingcheng.pojo.system.Role;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface RoleMapper extends Mapper<Role> {

    @Select("SELECT COUNT(NAME) countName,NAME,r.id,r.status ,DATE_FORMAT(r.create_time,'%Y-%m-%d %H:%i:%s') create_time FROM `tb_role` r\n" +
            "INNER JOIN `tb_admin_role` ar\n" +
            "ON r.id=ar.role_id\n" +
            "INNER JOIN tb_admin a\n" +
            "ON ar.admin_id=a.id\n" +
            "WHERE a.delete_id=1\n" +
            "AND r.delete_id=1\n"+
            "GROUP BY NAME")
    List<Map> queryByRole();
}
